<!DOCTYPE html	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
	</ui:define>
	<ui:define name="content">

		<div class="full-content">
			<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
				<p:commandButton value="是" type="button"
					styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
				<p:commandButton value="否" type="button"
					styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
			</p:confirmDialog>
			<p:growl id="msgs" showDetail="true" />
			<p:tabView>
				<p:tab title="指标等级">
					<h:form id="form1">

						<p:toolbar id="btnBar" rendered="#{s:hasPermission(session,'xtsz_KPIzbcssz_zbdj_xj') or
						 s:hasPermission(session,'xtsz_KPIzbcssz_zbdj_sc')}">
							<f:facet name="left">
								<p:commandButton id="cgBtn" value="新建" icon="ui-icon-document"
									rendered="#{s:hasPermission(session,'xtsz_KPIzbcssz_zbdj_xj')}"
									update="form1:levelRecordTb"
									actionListener="#{kpiDictController.createLevel}" />
								<p:commandButton value="删除" id="delbtn" icon="ui-icon-trash"
									rendered="#{s:hasPermission(session,'xtsz_KPIzbcssz_zbdj_sc')}"
									update="form1:levelRecordTb"
									actionListener="#{kpiDictController.deleteLevel}">
									<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
								</p:commandButton>
							</f:facet>
						</p:toolbar>
						<p:dataTable var="item" id="levelRecordTb"
							widgetVar="levelRecordTb" emptyMessage="无记录"
							value="#{kpiDictController.levels}" rows="8"
							selection="#{kpiDictController.selectedLevel}"
							rowKey="#{item.id}" editable="true" editMode="cell">
							<p:column selectionMode="single"
								style="width:16px;text-align:center" />
							<p:ajax event="cellEdit"
								listener="#{kpiDictController.onLevelCellEdit}" update="@this" />
							<p:column width="25" headerText="序号 ">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{item.sno}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText id="sno" value="#{item.sno}" style="width:96%" />
									</f:facet>
								</p:cellEditor>
							</p:column>
							<p:column width="80" headerText="名称">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{item.name}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText id="name" value="#{item.name}" style="width:96%" />
									</f:facet>
								</p:cellEditor>
							</p:column>
							<p:column width="80" headerText="可靠度">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{item.value}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText id="value" value="#{item.value}"
											style="width:96%" />
									</f:facet>
								</p:cellEditor>
							</p:column>
							<p:column width="80" headerText="备注">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{item.remark}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText id="remark" value="#{item.remark}"
											style="width:96%" />
									</f:facet>
								</p:cellEditor>
							</p:column>
						</p:dataTable>
					</h:form>
				</p:tab>
				<p:tab title="数据源维护">
					<h:form id="form2">

						<p:toolbar id="toolbar2" rendered="#{s:hasPermission(session,'xtsz_KPIzbcssz_sjywh_xj') or
						s:hasPermission(session,'xtsz_KPIzbcssz_sjywh_sc')}">
							<f:facet name="left">
								<p:commandButton id="createDsBtn" value="新建"
									icon="ui-icon-document"
									rendered="#{s:hasPermission(session,'xtsz_KPIzbcssz_sjywh_xj')}"
									update="form2:dsRecordTb"
									actionListener="#{kpiDictController.createDs}" />
								<p:commandButton value="删除" id="delbtn" icon="ui-icon-trash"
									rendered="#{s:hasPermission(session,'xtsz_KPIzbcssz_sjywh_sc')}"
									update="form2:dsRecordTb"
									actionListener="#{kpiDictController.deleteDs}">
									<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
								</p:commandButton>
							</f:facet>
						</p:toolbar>
						<p:dataTable var="item" id="dsRecordTb" widgetVar="dsRecordTb" emptyMessage="无记录" value="#{kpiDictController.ds}" rows="20"
							selection="#{kpiDictController.selectedDs}" rowKey="#{item.id}" editable="true" editMode="cell" paginator="true"
							paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
							rowsPerPageTemplate="20,30,50" paginatorPosition="bottom">
							<p:column selectionMode="single"
								style="width:16px;text-align:center" />
							<p:ajax event="cellEdit"
								listener="#{kpiDictController.onDsCellEdit}" update="@this" />
							<f:facet name="{Customization}">
								<p:outputLabel value="总计：#{kpiDictController.ds.size()} 条记录" style="margin-right:20px;" />
							</f:facet>
							<p:column width="50" headerText="名称">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{item.name}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText id="name" value="#{item.name}" style="width:96%" />
									</f:facet>
								</p:cellEditor>
							</p:column>
							<p:column width="25" headerText="是否可用 ">
								<p:cellEditor>
									<f:facet name="output">
										<h:selectBooleanCheckbox value="#{item.available}" />
									</f:facet>
									<f:facet name="input">
										<h:selectBooleanCheckbox id="available"
											value="#{item.available}" style="width:96%" />
									</f:facet>
								</p:cellEditor>
							</p:column>
							<p:column width="30" headerText="可靠度">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{item.reliabilityParam}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText id="reliabilityParam"
											value="#{item.reliabilityParam}" style="width:96%" />
									</f:facet>
								</p:cellEditor>
							</p:column>
							<p:column width="80" headerText="数据源描述">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{item.reliabilityDesc}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText id="reliabilityDesc"
											value="#{item.reliabilityDesc}" style="width:96%" />
									</f:facet>
								</p:cellEditor>
							</p:column>
							<p:column width="80" headerText="数据源来源">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{item.sourceDesc}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText id="sourceDesc" value="#{item.sourceDesc}"
											style="width:96%" />
									</f:facet>
								</p:cellEditor>
							</p:column>
						</p:dataTable>
					</h:form>
				</p:tab>
			</p:tabView>

		</div>
	</ui:define>
</ui:composition>